#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<list>
#include<vector>

using namespace std;

void paint_list(list<int>& l)
{
	for (auto ch : l)
	{
		cout << ch << " ";
	}
	cout << endl;
}
void test1()
{
	list<int> l1(5, 1);
	paint_list(l1);
}

void test2()
{
	list<int> l2;
	paint_list(l2);
}

void test3()
{
	list<int> l3(5,3);
	list<int> l4(l3);
	paint_list(l4);
}

void test4()
{
	vector<int> v4{ 1,2,3,4,5 };
	list<int> l4(v4.begin(), v4.end());
	paint_list(l4);
}

void test5()
{
	list<int> l5{ 1,2,3,4,5 };
	list<int> l6(l5.begin(), l5.end());
	list<int> l7(l5.rbegin(), l5.rend());
	paint_list(l6);
	paint_list(l7);
}

void test6()
{
	list<int> l6(5, 6);
	list<int> l7;
	cout<<l6.empty()<<endl;
	cout<<l7.empty()<<endl;
	
}

void test7()
{
	list<int> l7(5, 7);
	cout << l7.size() << endl;
}

void test8()
{
	list<int> l8{ 1,2,3,4,5 };
	cout << l8.front() << endl;
	cout << l8.back() << endl;

}

void test9()
{
	list<int> l9(5, 9);
	l9.push_front(1);
	paint_list(l9);
}

void test10()
{
	list<int> l10{ 1,2,3,4,5 };
	l10.pop_front();
	paint_list(l10);
}

void test11()
{
	list<int> l11{ 1,2,3,4,5 };
	l11.push_back(6);
	paint_list(l11);
}

void test12()
{
	list<int> l12{ 1,2,3,4,5 };
	l12.pop_back();
	paint_list(l12);
}

void test13()
{
	list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);
	lt.push_back(5);
	lt.push_back(6);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	auto it = lt.begin();
	int k = 3;
	while (k--)
	{
		++it;
	}

	lt.insert(it, 30);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test14()
{
	list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);
	lt.push_back(5);
	lt.push_back(6);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	auto it = lt.begin();
	int k = 3;
	while (k--)
	{
		++it;
	}

	lt.erase(it);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

}

void test15()
{
	list<int> l15(15, 7);
	list<int> l16(15, 8);
	paint_list(l15);
	paint_list(l16);

	swap(l15, l16);
	paint_list(l15);
	paint_list(l16);

}

void test16()
{
	list<int> l16(15, 7);
	paint_list(l16);
	l16.clear();
	paint_list(l16);
}

int main()
{
	test16();
	return 0;
}